using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.Serialization;
using System.Collections.Concurrent;
using System.ServiceModel;
using GZ.Modular.Log;
using GZ.Modular.Redis;
using GZ.Modular.Database;
using MongoDB.Driver;
using Dapper;
using System.Configuration;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using GZ.DB.Entity.wcs_hy;
using GZ.DB.IRepository.wcs_hy;
using GZ.DB.Repository.wcs_hy;
using GZ.Common.Data;
using Newtonsoft.Json;
using System.Security.Cryptography;
using System.Net;
using System.Threading;
using System.Globalization;
using System.IO.Ports;
using System.Drawing;
namespace GZ.Projects.WCS_YB
{
public class ObjectConvert:IMultiValueConverter
{
#region    [自定义类][20250516191646769][ObjectConvert]
	
#region IMultiValueConverter Members

public static object ConverterObject;

public object Convert(object[] values, Type targetType,
                      object parameter, System.Globalization.CultureInfo culture)
{
	ConverterObject = values;
	string str = values.GetType().ToString();
	return values.ToArray();
}

public object[] ConvertBack(object value, Type[] targetTypes,
                            object parameter, System.Globalization.CultureInfo culture)
{
	throw new NotImplementedException();
}

#endregion
#endregion [自定义类][20250516191646769][ObjectConvert]
}
public class DictItem
{
#region    [自定义类][20250516191710466][DictItem]
	public string DictName { get; set; } 
public string DictValue { get; set; } 
#endregion [自定义类][20250516191710466][DictItem]
}
public class PlcLogEntity
{
#region    [自定义类][20250517205715896][PlcLogEntity]
	

[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; }
public string tag_id { get; set; }
public int position { get; set; }
public string old_value { get; set; }
public string new_value { get; set; }
public DateTime timestamp { get; set; }
public double timespan { get; set; }
public int next { get; set; }
public int flag { get; set; }

#endregion [自定义类][20250517205715896][PlcLogEntity]
}
public class TaskState_Convert:IValueConverter
{
#region    [自定义类][20250717095455475][TaskState_Convert]
		//任务状态
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
	if (value != null)
	{
		string index = value.ToString();
		switch (index)
		{
				//Create 已创建
			case "Create":
				return "已创建";
				
				//Pre 待下发
			case "Pre":
				return "待下发";
				
				//Send 已下发
			case "Send":
				return "已下发";
				
				//Doing 执行中
			case "Doing":
				return "执行中";
				
				//Finish 执行完成
			case "Finish":
				return "执行完成";
				
				//Error 执行异常
			case "Error":
				return "执行异常";
				
				//Cancel 取消
			case "Cancel":
				return "取消";
				
			case "WaitEnd":
				return "等待入库";
								
			case "Reallocate":
				return "重分中";
				
			case "Running":
				return "移动中";	
			default:
				return index;
		}
	}
	else
	{
		throw new ArgumentNullException("value can not be null");
	}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
	throw new NotImplementedException();
}
#endregion [自定义类][20250717095455475][TaskState_Convert]
}
public class TaskType_Convert:IValueConverter
{
#region    [自定义类][20250717095812211][TaskType_Convert]
	//任务类型
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
	if (value != null)
	{
		//任务细分类型（无细分时，等于单据类型），项目定制，例：[CH=出库需换箱，CN=出库不需换箱]、[YA=出库移库，YM=手动移库，YE=闲时移库]
		string index = value.ToString();
		switch (index)
		{
			//case "CH":
			//	return "出库需换箱";
			//case "CN":
			//	return "出库不需换箱";
			case "ST_Move":
				return "移库";
			case "ST_Out":
				return "出库";
			case "ST_In":
				return "入库";
			case "ST_Check":
				return "盘库";
			default:
				return index;
		}
	}
	else
	{
		throw new ArgumentNullException("value can not be null");
	}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
	throw new NotImplementedException();
}
#endregion [自定义类][20250717095812211][TaskType_Convert]
}
public class Order_type_Convert:IValueConverter
{
#region    [自定义类][20250717095937363][Order_type_Convert]
	
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
	//R=入库，C=出库，Y=移库，D=调拨，C=抽检，T=退货，P=盘库
	if (value != null)
	{
		string index = value.ToString();
		switch (index)
		{
			case "R":
				return "入库";
			case "C":
				return "出库";
			case "Y":
				return "移库";
			case "D":
				return "调拨";
			case "J":
				return "抽检";
			case "T":
				return "退货";
			case "P":
				return "盘库";
			default:
				return index;
		}
	}
	else
	{
		throw new ArgumentNullException("value can not be null");
	}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
	throw new NotImplementedException();
}
#endregion [自定义类][20250717095937363][Order_type_Convert]
}
public class DeviceErrorState_Convert:IValueConverter
{
#region    [自定义类][20250717100501677][DeviceErrorState_Convert]
	//故障状态
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
	if (value != null)
	{
		string index = value.ToString();
		switch (index)
		{
			case "Error":
				return "故障中";
			case "OK":
				return "已解决";
			default:
				return index;
		}
	}
	else
	{
		throw new ArgumentNullException("value can not be null");
	}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
	throw new NotImplementedException();
}
#endregion [自定义类][20250717100501677][DeviceErrorState_Convert]
}
public class OpeType_Log_Convert:IValueConverter
{
#region    [自定义类][20250717100547806][OpeType_Log_Convert]
	//日志操作类型
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
	if (value != null)
	{
		int index = System.Convert.ToInt32(value);
		switch (index)
		{
			case 1:
				return "系统触发";
			case 2:
				return "按钮点击";
			case 3:
				return "事件触发";
			default:
				return "";
		}
	}
	else
	{
		throw new ArgumentNullException("value can not be null");
	}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
	throw new NotImplementedException();
}
#endregion [自定义类][20250717100547806][OpeType_Log_Convert]
}
public class LogType_Log_Convert:IValueConverter
{
#region    [自定义类][20250717100644579][LogType_Log_Convert]
	//日志类型
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
	if (value != null)
	{
		int index = System.Convert.ToInt32(value);
		switch (index)
		{
			case 1:
				return "系统日志";
			case 2:
				return "操作日志";
			case 3:
				return "事件日志";
			default:
				return "";
		}
	}
	else
	{
		throw new ArgumentNullException("value can not be null");
	}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
	throw new NotImplementedException();
}
#endregion [自定义类][20250717100644579][LogType_Log_Convert]
}
}